<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\file\FileInput;
use yii\helpers\Url;
use yii\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $model backend\modules\pooai\models\ZpooaiGallImages */
/* @var $form yii\widgets\ActiveForm */
?>
<style>
    .jq22 { width: 1000px; margin: 0 auto; font-family: arial,SimSun; font-size: 0;}
    .jq22 .item { display: inline-block; width: 230px; height: 100px; margin: 0 20px 20px 0; background-color: #ccc;}
    .jq22 .item1 { background-color: #1faeff;}
    .jq22 .item2 { background-color: #ff2e12;}
    .jq22 .item3 { background-color: #00c13f;}
    .jq22 .item4 { background-color: #e1b700;}
    .jq22 .item5 { background-color: #7200ac;}
    .jq22 .item6 { background-color: #ff76bc;}
    .jq22 .item7 { background-color: #001e4e;}
    .jq22 .item8 { background-color: #632f00;}
    .jq22 span { display: block; height: 100px; line-height: 100px; font-size: 2rem; text-align: center; color: #fff;}
</style>

<div class="zpooai-gall-images-form">

    <?php $form = ActiveForm::begin(); ?>

    <div class="FormPage01">
        <?= $form->field($model, 'zpooai_pages_id')->dropDownList(ArrayHelper::map($zpooaiPages,'pooai_pages_id', 'pooai_pages_name'), ['prompt' => '请选择页面']); ?>
        <input name="pooai_pages_id" type="hidden" id="pooai_pages_id" value="" />
        <?=$form->field($model, 'images[]')->label(Yii::t('catalog','Image(请先上传图片)'))->widget(FileInput::classname(), [
            'language' => 'zh',
            'options' => [ 'accept' => 'image/*', 'multiple'=>true],
            'pluginOptions' => [
                'initialPreview'=>[],
                'initialPreviewConfig'=>[],
                'overwriteInitial'=>false,
                'uploadUrl' => Url::to(['/pooai/zpooaigallimages/upload']),
                'uploadExtraData' => [
                    'item_id' => 3,
                    'position' => 5//TODO:  js
                ],
                'maxFileCount' => 10,
                'allowedFileExtensions'=>['jpg','gif','png']
            ]
        ]);?>
    </div>

    <div class="FormPage02" style="display: none">
        <div class="jq22">
            <div class="item item1"><span>1</span></div>
            <div class="item item2"><span>2</span></div>
            <div class="item item3"><span>3</span></div>
            <div class="item item4"><span>4</span></div>
            <div class="item item5"><span>5</span></div>
            <div class="item item6"><span>6</span></div>
            <div class="item item7"><span>7</span></div>
            <div class="item item8"><span>8</span></div>
        </div>
        <script>
            $(function(){
                $('.jq22').dad();;
            });
        </script>
    </div>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
<script>
    $('#zpooaigallimages-zpooai_pages_id').change(function() {
        var pageId = $(this).val();
        $("#pooai_pages_id").val(pageId);
    });
</script>
